package com.lanlian.cayman.adapter;

import android.support.annotation.Nullable;
import android.text.Html;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lanlian.commonlib.bean.db.DBMessage;
import com.lanlian.cayman.R;

import java.util.List;

/**
 * <pre>
 *     author : huxiaobo
 *     e-mail : huxiaobo@xlanlian.com
 *     date   : 2018/8/15 16:55
 *     desc   : 消息中心Adapter
 *     version: 1.0
 * </pre>
 */
public class MessageAdapter extends BaseQuickAdapter<DBMessage, BaseViewHolder> {

    public MessageAdapter(int layoutResId, @Nullable List<DBMessage> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DBMessage item) {
        helper.setGone(R.id.view, helper.getLayoutPosition() == 0);
        helper.setText(R.id.tv_time, item.getPushTime())
                .setText(R.id.tv_title, item.getTitle())
                .setText(R.id.tv_content, Html.fromHtml(item.getContent()));
        helper.setGone(R.id.tv_point, item.getIsRead() == 0);
    }

}
